﻿using System;
using Microsoft.SharePoint;

namespace PDSPReGhost
{
    class Program
    {
        static void Main(string[] args)
        {
            string siteUrl = args[0].ToString();
            SPSite _site = new SPSite(siteUrl);
            foreach (SPWeb Web in _site.AllWebs)
            {
                try
                {
                    Console.WriteLine("Reghosting: " + Web.Url.ToString());
                    Web.RevertAllDocumentContentStreams();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error ReGhosting:" + ex.Message);
                }
            }
        }
    }
}